﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data;
using System.Web.UI;
using System.Web.UI.WebControls;
using EnvironmentManagerSystem.MODE;
using EnvironmentManagerSystem.BLL;
using EnvironmentManagerSystem.Utility;
using System.Collections;
using System.Configuration;
using System.Web.Security;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls.WebParts;
using System.IO;
using System.Text;
using System.Drawing;
namespace EnvironmentManagerSystem.SearchQuery
{
    public partial class SDSXiangMu : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (StfInfo.ReSession()) return; if (!IsPostBack)
            {
                RoleID.Text = Session["roleid"].ToString();

                #region 按RoleID决定TABLE显示还是隐藏(x)
                if (RoleID.Text == "环评单位")
                {
                    table1.Visible = false;
                    table2.Visible = false;
                    table3.Visible = false;
                    table4.Visible = false;
                    table5.Visible = false;
                    table6.Visible = false;
                    table7.Visible = false;
                    table8.Visible = false;
                    table9.Visible = false;
                }
                else if (RoleID.Text == "建设单位")
                {
                    table1.Visible = false;
                    table2.Visible = false;
                    table3.Visible = false;
                    table4.Visible = false;
                    table5.Visible = false;
                    table6.Visible = false;
                    table7.Visible = false;
                    table8.Visible = false;
                    table9.Visible = false;
                }
                else
                {
                    table1.Visible = true;
                    table2.Visible = true;
                    table3.Visible = true;
                    table4.Visible = true;
                    table5.Visible = true;
                    table6.Visible = true;
                    table7.Visible = true;
                    table8.Visible = true;
                    table9.Visible = true;
                }
                #endregion

                if (Session["pjName"] != null && !Session["pjName"].ToString().Equals("") && !Session["pjName"].ToString().Equals("无"))
                {
                    DevelopprojectbasicinfoDataCollection lst = BLL.NoticeService.GetByIDPs(Session["pjName"].ToString());
                    foreach (var item in lst)
                    {
                        #region Label.Text(x)
                        if (item.ProjectLog == null)//项目日志 
                        {
                            lblProjectLog.Text = "无";
                        }
                        else
                        {
                            lblProjectLog.Text = item.ProjectLog;
                        }
                        if (item.hesuanren == null)//核算人 
                        {
                            lblApprovedPeople.Text = "无";
                        }
                        else
                        {
                            lblApprovedPeople.Text = item.hesuanren;
                        }

                        if (item.hedinghetongjine == null)//核定合同金额
                        {
                            lblhedinghetongjine.Text = "无";
                        }
                        else
                        {
                            lblhedinghetongjine.Text = item.hedinghetongjine;
                        }
                        if (item.biaozhunhetongjine == null)//标准合同金额
                        {
                            lblbiaozhunhetongjine.Text = "无";
                            LinkButton4.Visible = false;
                        }
                        else
                        {
                            lblbiaozhunhetongjine.Text = item.biaozhunhetongjine;
                            LinkButton4.Visible = true;
                        }
                        if (item.hangyexishu == null)//行业系数
                        {
                            lblIndustry.Text = "无";
                        }
                        else
                        {
                            lblIndustry.Text = item.hangyexishu;
                        }
                        if (item.nanduxishu == null)//难度系数
                        {
                            lblnanduxishu.Text = "无";
                        }
                        else
                        {
                            lblnanduxishu.Text = item.nanduxishu;
                        }
                        if (item.fenpeizhixingbumen == null)//该项目执行部门
                        {
                            lblbumen.Text = "无";
                        }
                        else
                        {
                            lblbumen.Text = item.fenpeizhixingbumen;
                        }
                        if (item.tachariqi == null)//踏察日期
                        {
                            lbltachariqi.Text = "无";
                        }
                        else
                        {
                            lbltachariqi.Text = item.tachariqi;
                        }
                        if (item.tachadidian == null)//踏察地点
                        {
                            lbltachadidian.Text = "无";
                        }
                        else
                        {
                            lbltachadidian.Text = item.tachadidian;
                        }
                        if (item.tachazhuanjia == null)//踏察专家
                        {
                            lbltachazhuanjia.Text = "无";
                        }
                        else
                        {
                            lbltachazhuanjia.Text = item.tachazhuanjia;
                        }
                        if (item.zhuanjiahuiyididian == null)//专家会议地点
                        {
                            lblzhuanjiahuiyididian.Text = "无";
                        }
                        else
                        {
                            lblzhuanjiahuiyididian.Text = item.zhuanjiahuiyididian;
                        }
                        if (item.zhuanjiahuiyizhuanjian == null)//专家会议会议专家
                        {
                            lblzhuanjiahuiyizhuanjian.Text = "无";
                        }
                        else
                        {
                            lblzhuanjiahuiyizhuanjian.Text = item.zhuanjiahuiyizhuanjian;
                        }
                        if (item.dbuhuiDataValue == null)//不合格条款
                        {
                            lblbuhegetiaokuan.Text = "无";
                        }
                        else
                        {
                            lblbuhegetiaokuan.Text = item.dbuhuiDataValue;
                        }
                        if (item.pingguyijianxiangmuzhuangtai == null)//评估意见项目状态
                        {
                            lblpingguyijianxiangmuzhuangtai.Text = "无";
                        }
                        else
                        {
                            lblpingguyijianxiangmuzhuangtai.Text = item.pingguyijianxiangmuzhuangtai;
                        }
                        if (item.chugaokaoping == null)//初稿考评
                        {
                            lblchugaokaoping.Text = "无";
                        }
                        else
                        {
                            lblchugaokaoping.Text = item.chugaokaoping;
                        }
                        if (item.zhonggaokaoping == null)//终稿考评
                        {
                            lblzhonggaokaoping.Text = "无";
                        }
                        else
                        {
                            lblzhonggaokaoping.Text = item.zhonggaokaoping;
                        }
                        if (item.fushenhuiyipingshenjieguo == null)//复审会议评审结果
                        {
                            lblfushenhuiyipingshenjieguo.Text = "无";
                        }
                        else
                        {
                            lblfushenhuiyipingshenjieguo.Text = item.fushenhuiyipingshenjieguo;
                        }

                        if (item.huiyipingshenjieguo == null)//会议评审结果
                        {
                            lblhuiyipingshenjieguo.Text = "无";
                        }
                        else
                        {
                            lblhuiyipingshenjieguo.Text = item.huiyipingshenjieguo;
                        }
                        if (item.pingguyijianhuiyididian == null)//会议地点
                        {
                            lblpingguyijianhuiyididian.Text = "无";
                        }
                        else
                        {
                            lblpingguyijianhuiyididian.Text = item.pingguyijianhuiyididian;
                        }
                        if (item.pingguyijianhuiyiriqi == null)//会议日期
                        {
                            lblpingguyijianhuiyiriqi.Text = "无";
                        }
                        else
                        {
                            lblpingguyijianhuiyiriqi.Text = item.pingguyijianhuiyiriqi;
                        }
                        if (item.yijianbeizhu == null)//专家意见备注
                        {
                            lblyijianbeizhu.Text = "无";
                        }
                        else
                        {
                            lblyijianbeizhu.Text = item.yijianbeizhu;
                        }
                        if (item.buhegeshuoming == null)//评估不合格说明
                        {
                            lblbuhegeshuoming.Text = "无";
                        }
                        else
                        {
                            lblbuhegeshuoming.Text = item.buhegeshuoming;
                        }
                        if (item.zhuanjiahuiyichuliriqi == null)//会议日期
                        {
                            lblzhuanjiahuiyichuliriqi.Text = "无";
                        }
                        else
                        {
                            lblzhuanjiahuiyichuliriqi.Text = item.zhuanjiahuiyichuliriqi;
                        }
                        if (item.hantacha == 1)
                        {
                            lblhantacha.Text = "含踏查";
                        }

                        if (item.hanhuiyi == 1)
                        {
                            lblhanhuiyi.Text = "含会议";
                        }
                        if (item.lvsetongdao == 1)
                        {
                            lbllvsetongdao.Text = "绿色通道";
                        }
                        if (item.biangengxiangmu == 1)
                        {
                            lblbiangengxiangmu.Text = "变更项目";
                        }
                        if (item.huizongshangbaoshumiancailiao == null)//汇总上报书面材料
                        {
                            lblhuizongshangbaoshumiancailiao.Text = "无";
                        }
                        else
                        {
                            lblhuizongshangbaoshumiancailiao.Text = item.dhuiDataValue;
                        }
                        if (item.pingshenxiangmufuzeren == null)//评审项目负责人
                        {
                            lblpingshenxiangmufuzeren.Text = "无";
                        }
                        else
                        {
                            lblpingshenxiangmufuzeren.Text = item.pingshenxiangmufuzeren;
                        }
                        //if (item.projectreportstate == 0)//汇总上报书面材料
                        //{
                        //    lblprojectreportstate.Text = "未上报";
                        //}
                        //if (item.projectreportstate == 1)
                        //{
                        //    lblprojectreportstate.Text = "已上报";
                        //}
                        if (item.shangwu == 1)
                        {
                            lblshangwu.Text = "上午";
                        }
                        if (item.xiawu == 1)
                        {
                            lblxiawu.Text = "下午";
                        }
                        if (item.zhuanjiahuiyiriqiflag == 1)
                        {
                            lblzhuanjiahuiyiriqiflag.Text = "上午";
                        }
                        if (item.zhuanjiahuiyiriqiflag == 2)
                        {
                            lblzhuanjiahuiyiriqiflag.Text = "下午";
                        }
                        #endregion

                        #region MyRegion(x)
                        labXiangMuKaoPing.Text = item.AppraisalTrace;//项目考评步骤
                        lbiyichuli.Text = item.OpinionTrace;//评估意见步骤
                        labConfirmMeeting.Text = item.ExpertMeetingTrace;//专家会议步骤
                        //labConfirmMeetingTime
                        labConfirmLook.Text = item.LookTrace;//现场踏察步骤
                        //labSetLookDate
                        labConfirmHead.Text = item.ResponTrace;//项目负责步骤
                        //labHeadBack
                        labDepartment.Text = item.DistributionTrace;//部门负责步骤
                        //labDepartmentBack
                        //labReportSave
                        labReportOK.Text = item.ReportingTrace;//汇总上报
                        if (item.yushenxiangmu == 1)//预审
                        {
                            yushen.Text = "已预审";
                        }
                        //else { yushen.Text = "未预审"; }
                        //if (item.shoulituihuishanchu == 1)//受理
                        //{
                        //    shouli.Text = "已受理";
                        //}
                        if (item.shoulituihuishanchu == 1)
                        {
                            shouli.Text = "受理";
                            Label1.Text = "(" + item.xiangmushouliren + ")";
                            Label2.Text = item.xiangmushoulishijian;
                        }

                        //else
                        //{
                        //    shouli.Text = "未受理";
                        //}
                        #endregion
                    }
                }
            }
        }

        #region 合同下载(x)
        protected void LinkButton4_Click(object sender, EventArgs e)
        {
            DataTable dt = XIANGMU.GetProjectInfo();
            OfficeHelper.updateContract(this, dt);
            OfficeHelper.DownFile(this, Server.MapPath(Session["pjName"].ToString() + ".xls"));
        }
        #endregion
    }
}
